# frozen_string_literal: true

class Admin::ApplicationController < ActionController::Base
  layout 'layouts/admin_application'
  before_action :check_auth
  protect_from_forgery with: :exception

  def current_admin
    @current_admin ||= Admin.where(telephone: session[:admin]).first
  end

  def check_auth
    @current_admin ||= Admin.where(telephone: session[:admin]).first
    redirect_to new_session_path if @current_admin.blank?
  end
end
